/**
 * author      : dormi330
 * date        : 2018/6/26
 * project     : mybatis
 * description : 应用层服务
 */

package com.deep.trade.application;

import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.deep.trade.application.cart.CartQueryService;
import com.deep.trade.application.cart.CartService;
import com.deep.trade.cart.CartApi;
import com.deep.trade.cart.InDtoCart;
import com.deep.trade.cart.query.CartQueryApi;
import com.deep.trade.cart.query.OutDtoCartItem;

@Service
public class CartServiceFacade implements CartApi, CartQueryApi {

    @Autowired
    private CartService cartService;

    @Autowired
    private CartQueryService cartQueryService;


    //========================================== CartApi ==========================================//
    @Override
    public void addSkuToCart(InDtoCart inDtoCart) throws Exception {
        cartService.addSkuToCart(inDtoCart);
    }

    @Override
    public void removeSkuFromCart(InDtoCart inDtoCart) throws Exception {
        // TODO
        cartService.removeSkuFromCart(inDtoCart);
    }

    @Override
    public void alterQuantity(InDtoCart inDtoCart) throws Exception {
        // TODO
        throw new Exception("TODO");
    }
    //========================================== CartApi ==========================================//


    //========================================== CartQueryApi ==========================================//

    @Override
    public PageInfo<OutDtoCartItem> cartOfMember(String tenantCode, String memberId, int pageNum, int pageSize) throws Exception {
        return cartQueryService.cartOfMember(tenantCode, memberId, pageNum, pageSize);
    }
    //========================================== CartQueryApi ==========================================//

}
